package com.example.demo.PyTest.entity;

import lombok.Data;

/**
 * 区间对象
 *
 * @author FF998
 */
@Data
public class SectionEntity {

    /**
     * 区间下限
     */
    private Double intervalLower;

    /**
     * 区间上限
     */
    private Double intervalUpper;

    /**
     * 区间占比
     */
    private Double intervalProportion;

    /**
     * 色值
     */
    private String colorValue;

    public SectionEntity(Double intervalLower, Double intervalUpper,String colorValue) {
        this.intervalLower = intervalLower;
        this.intervalUpper = intervalUpper;
        this.colorValue = colorValue;
    }

    public boolean isInSection(Double key) {
        return (intervalLower == null || key >= intervalLower) && (intervalUpper == null || key < intervalUpper);
    }
}
